package hy.dao;

import hy.entity.Item;
import hy.entity.Order;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

@Repository
public class OrderDao {
    @Resource(name="tmpA")
    JdbcTemplate tmpA;

    public void saveOrder(Order o){
        tmpA.update("insert into order_t (orderNo,phone,status) values(?,?,?)",o.getOrderNo(),o.getPhone(),o.getStatus());
    }

    public void saveItems(Item i) {
        tmpA.update("insert into item_t (orderNo,bookId,num) values(?,?,?)",i.getOrderNo(),i.getBookId(),i.getNum());
    }
}